home *** CD-ROM | disk | FTP | other *** search
-
- GETHOSTNAME(3) UNIX Programmer's Manual GETHOSTNAME(3)
-
- NNAAMMEE
- ggeetthhoossttnnaammee, sseetthhoossttnnaammee - get/set name of current host
-
- SSYYNNOOPPSSIISS
- ##iinncclluuddee <<uunniissttdd..hh>>
-
- _i_n_t
- ggeetthhoossttnnaammee(_c_h_a_r _*_n_a_m_e, _i_n_t _n_a_m_e_l_e_n)
-
- _i_n_t
- sseetthhoossttnnaammee(_c_o_n_s_t _c_h_a_r _*_n_a_m_e, _i_n_t _n_a_m_e_l_e_n)
-
- DDEESSCCRRIIPPTTIIOONN
- GGeetthhoossttnnaammee() returns the standard host name for the current processor,
- as previously set by sseetthhoossttnnaammee(). The parameter _n_a_m_e_l_e_n specifies the
- size of the _n_a_m_e array. The returned name is null-terminated unless in-
- sufficient space is provided.
-
- SSeetthhoossttnnaammee() sets the name of the host machine to be _n_a_m_e, which has
- length _n_a_m_e_l_e_n. This call is restricted to the super-user and is normally
- used only when the system is bootstrapped.
-
- RREETTUURRNN VVAALLUUEESS
- If the call succeeds a value of 0 is returned. If the call fails, a val-
- ue of -1 is returned and an error code is placed in the global location
- _e_r_r_n_o.
-
- EERRRROORRSS
- The following errors may be returned by these calls:
-
- [EFAULT] The _n_a_m_e or _n_a_m_e_l_e_n parameter gave an invalid address.
-
- [EPERM] The caller tried to set the hostname and was not the super-
- user.
-
- SSEEEE AALLSSOO
- sysctl(2) gethostid(3)
-
- BBUUGGSS
- Host names are limited to MAXHOSTNAMELEN (from <_s_y_s_/_p_a_r_a_m_._h>) characters,
- currently 256.
-
- HHIISSTTOORRYY
- The ggeetthhoossttnnaammee function call appeared in 4.2BSD.
-
- 4.2 Berkeley Distribution June 4, 1993 1
-